Skip to content

Moving away from msdia managed wrapper, to doing P/Invoke on msdia.#1018

Merged
mayankbansal018 merged 9 commits intomicrosoft:masterfrom
mayankbansal018:pinvokedia
Aug 28, 2017
Merged

Moving away from msdia managed wrapper, to doing P/Invoke on msdia.#1018
mayankbansal018 merged 9 commits intomicrosoft:masterfrom
mayankbansal018:pinvokedia

Conversation

@mayankbansal018
Copy link
Contributor

@mayankbansal018 mayankbansal018 commented Aug 23, 2017

###Test Matrix

  TestHost SDK(Old) TestHost SDK(New)
VsTest(Old) Portable-- No Change Full - No Change Portable -- Navigation Fixed Full -- No Change
VsTest(New) Portable-- Navigation Fail(No Change) Full - No Change Portable-- Navigation Fixed Full - No Change

need to fix acquisition of msdia for portable, this PR will fail
@mayankbansal018
Copy link
Contributor Author

@dotnet-bot test this please

@mayankbansal018 mayankbansal018 requested a review from codito August 28, 2017 07:34
catch (COMException)
{
return false;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Throw exception here and Dispose

$fullCLRPackageDir = Get-FullCLRPackageDirectory
$coreCLRPackageDir = Get-CoreCLRPackageDirectory
$coreCLR20PackageDir = Get-CoreCLR20PackageDirectory
$coreCLR20TestHostPackageDir = Get-CoreCLR20TestHostPackageDirectory
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: tab.

/// <summary>
/// Manifest files for Reg Free Com. This is essentially put in place for the msdia dependency.
/// </summary>
private const string ManifestFileNameX86 = "TestPlatform.ObjectModel.x86.manifest";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove vstest/src/testhost.x86/TestPlatform.ObjectModel.*.manifest files.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

if (HResult.Failed(this.source.LoadDataForExe(filename, searchPath, IntPtr.Zero)))
{
return false;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

throw exception with message here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

{
this.session.findLinesByAddr(symbol.addressSection, symbol.addressOffset, (uint)symbol.length, out lines);
// Get the address section
if (HResult.Failed(symbol.GetAddressSection(out uint section)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we combined all three 'if' statements with ||.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can, but I think code will be less readable.


public static IDiaDataSource GetDiaSourceObject()
{
var currentDirectory = new ProcessHelper().GetCurrentProcessLocation();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check how we are handling /Inproc scenario.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will check this once InProc comes into play. We will have to make some changes then definitely, will let faizan know

IntPtr modHandle = IntPtr.Zero;
if (IntPtr.Size == 8)
{
modHandle = LoadLibraryEx(Path.Combine(currentDirectory, "x64\\msdia140.dll"), IntPtr.Zero, 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we Path.PathSeparator here?

if(modHandle == IntPtr.Zero)
{
// Failed to load msdia140, why?
return null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log message or throw here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

public partial class ProcessHelper : IProcessHelper
{
/// <inheritdoc/>
public string GetCurrentProcessLocation()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Method name won't match defination, Should we rename to EntryPointDirectory?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from users perspective in netcore, the process would be the dll he/she is creating.

@mayankbansal018 mayankbansal018 merged commit 722818c into microsoft:master Aug 28, 2017
@mayankbansal018 mayankbansal018 deleted the pinvokedia branch August 28, 2017 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants